package com.chinasoft.goodsManager.servlet;

import com.alibaba.fastjson.JSON;
import com.chinasoft.goodsManager.goodslistserver.impl.ListServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileReader;
import java.io.IOException;

@WebServlet("/inf")
public class UserListinfServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        String value = request.getParameter("value");
        ListServiceImpl listService = new ListServiceImpl();
        Integer id = Integer.valueOf(value);
        Object[] arr = listService.detailed(id);
        //将arr打包发送出去
        String s = JSON.toJSONString(arr);
        response.getWriter().write(s);

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}
